package com.lxk.client.biz;

import com.lxk.spi.inface.PersonService;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransportException;

public class PersonServiceClient {

    private PersonService.Iface client;
    private TBinaryProtocol protocol;
    private TSocket transport;
    private String host;
    private int port;

    public void init(String host,int port) throws TTransportException {
        transport = new TSocket(host, port);
        protocol = new TBinaryProtocol(transport);
        client = new PersonService.Client(protocol);
        transport.open();
    }

    public PersonService.Iface getClient(){
        return client;
    }

    public void free(){
        transport.close();
    }

}
